home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / UI / IdleList.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  4.5 KB  |  167 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        IdleList.h
  3.  
  4.     Contains:    Interface to IdleInfo, IdleList and IdleListIterator classes.
  5.  
  6.     Owned by:    Richard Rodseth
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <6>     5/25/95    jpa        List.h --> LinkList.h [1253324]
  13.          <5>      4/4/95    RR        1228161 Pass ev to SetIdleFreq
  14.          <4>     1/31/95    RR        # 1206909 Pass ev to
  15.                                     RemoveUnregisteredIdlers
  16.          <3>     9/30/94    RR        #1167950 Allow unregistering while idling
  17.          <2>     9/20/94    RR        Added ev parameter to AddIdle and
  18.                                     RemoveIdle. #1154046 Moved ref counting
  19.                                     into IdleList methods so that an
  20.                                     unregistered part is not released.
  21.          <1>     5/13/94    RR        first checked in
  22.          <5>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  23.                                     #1150864.
  24.          <4>      2/9/94    NP        Tiger Team cleanup.
  25.          <3>     1/26/94    RR        Include ODTypes
  26.          <2>    12/20/93    RR        interface takes part/frame pairs rather
  27.                                     than frames
  28.          <1>    11/16/93    RR        first checked in
  29.  
  30.     To Do:
  31.     In Progress:
  32. */
  33.  
  34. #ifndef _IDLELIST_
  35. #define _IDLELIST_
  36.  
  37. #ifndef _ODTYPES_
  38. #include "ODTypes.h"
  39. #endif
  40.  
  41. #ifndef _PLFMDEF_
  42. #include "PlfmDef.h"
  43. #endif
  44.  
  45. #ifndef _LINKLIST_
  46. #include <LinkList.h>
  47. #endif
  48.  
  49. //==============================================================================
  50. // Theory of Operation
  51. //==============================================================================
  52.  
  53. //==============================================================================
  54. // Scalar Types
  55. //==============================================================================
  56.  
  57. typedef ODULong ODTicks; 
  58.  
  59. //=====================================================================================
  60. // Classes defined in this interface
  61. //=====================================================================================
  62.  
  63. class IdleInfo; 
  64. class IdleList;                
  65. class IdleListIterator;                
  66.  
  67. //=====================================================================================
  68. // Classes used by this interface
  69. //=====================================================================================
  70.  
  71. class ODFrame;
  72. class ODPart;
  73.  
  74. //=====================================================================================
  75. // Global Variables
  76. //=====================================================================================
  77.  
  78. //======================================================================================
  79. // Class IdleInfo
  80. //======================================================================================
  81.  
  82. class IdleInfo : public Link
  83. {
  84. public:
  85.     IdleInfo(ODPart* part, ODFrame* frame, ODIdleFrequency frequency);
  86.     virtual ~IdleInfo();
  87.  
  88.     ODBoolean NeedsIdle(ODTicks ticks);
  89.     ODTicks NextIdle(ODTicks ticks);
  90.     
  91.     ODPart* GetPart() { return fPart; }
  92.     ODFrame* GetFrame() { return fFrame; }
  93.     ODIdleFrequency GetIdleFrequency() { return fIdleFrequency; }
  94.     void SetIdleFrequency(ODIdleFrequency frequency) { fIdleFrequency = frequency; }
  95.     ODTicks GetLastIdle() { return fLastIdle; }
  96.     void SetLastIdle(ODTicks lastIdle) { fLastIdle = lastIdle; }
  97.     ODBoolean ShouldRemove() { return fRemove; }
  98.     void SetShouldRemove(ODBoolean shouldRemove) { fRemove = shouldRemove; }
  99.  
  100. private:    
  101.     ODPart*            fPart;
  102.     ODFrame*             fFrame;
  103.     ODIdleFrequency     fIdleFrequency;
  104.     ODSLong             fLastIdle;
  105.     ODBoolean        fRemove;
  106. };
  107.  
  108. //=====================================================================================
  109. // IdleList
  110. //=====================================================================================
  111.  
  112. class IdleList
  113. {
  114.     friend class IdleListIterator;
  115.     
  116. public:
  117.     IdleList();
  118.     virtual ~IdleList();
  119.     
  120.     void AddIdle(Environment* ev, ODPart* part, ODFrame* frame, ODIdleFrequency frequency); 
  121.     
  122.     void RemoveIdle(Environment* ev, ODPart* part, ODFrame* frame); 
  123.     
  124.     void SetIdleFrequency(Environment* ev, ODPart* part, ODFrame* frame, ODIdleFrequency frequency); 
  125.  
  126.     void RemoveUnregisteredIdlers(Environment* ev);
  127.     
  128. private:
  129.     LinkedList fImplementation;
  130. };
  131.  
  132. //=====================================================================================
  133. // IdleListIterator
  134. //=====================================================================================
  135.  
  136. class IdleListIterator
  137. {
  138. public:
  139.  
  140.     IdleListIterator(IdleList* idleList);
  141.     
  142.         // Constructor
  143.         
  144.     ODVMethod ~IdleListIterator();
  145.     
  146.         // Destructor
  147.     
  148.     ODMethod IdleInfo* First();
  149.     
  150.         // Returns the first element of the set
  151.         
  152.     ODMethod IdleInfo* Next();
  153.     
  154.         // Returns the next element in the set
  155.         
  156.     ODMethod ODBoolean IsNotComplete();
  157.     
  158.         // Returns TRUE as long as there are more elements in the set
  159.     
  160. private:
  161.     
  162.     LinkedListIterator fIterator;
  163.     
  164. };
  165.  
  166. #endif // _IDLELIST_
  167.